﻿using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using AutoMapper;
using Mt.Site.Core.Organizations.UserCache;
using Mt.Site.Core.WorkFlows.Design.Cache;
using Mt.Site.Core.WorkFlows.Design.Entities;
using Mt.Site.Core.WorkFlows.Enum;
using System;
using System.ComponentModel.DataAnnotations;

namespace Mt.Site.Application.WorkFlows.Dto
{
    [AutoMapTo(typeof(WorkFlowNode))]
    public class UpdateFlowNodeInput:EntityDto<Guid>
    {
        public bool IsActive { get; set; }

        //public int Order { get; set; }

        [StringLength(WorkFlowNode.MaxNameLength)]
        [Required]
        public string Name { get; set; }

        [StringLength(WorkFlowNode.MaxShortNameLength)]
        public string ShortName { get; set; }

        [StringLength(WorkFlowNode.MaxDescriptionLength)]
        public string Description { get; set; }

        public ActionScheme ActionScheme { get; set; }


        /// <summary>
        /// 下一步的备选项，id序列（,号分割）
        /// </summary>
        [StringLength(WorkFlowNode.MaxNextNodeListLength)]
        public string NextNodeList { get; set; }

        /// <summary>
        /// 后退的备选项，id序列（,号分割）
        /// </summary>
        [StringLength(WorkFlowNode.MaxBackNodeListLength)]
        public string BackNodeList { get; set; }

        [StringLength(WorkFlowNode.MaxUserIdListLength)]
        public string UserIdList { get; set; }

        /// <summary>
        /// IAction.UniqueName（,号分割）
        /// </summary>
        [StringLength(WorkFlowNode.MaxActionListLength)]
        public string ActionList { get; set; }

        /// <summary>
        /// 是否可以编辑附件
        /// </summary>
        public bool CanEditAttachment { get; set; }


        /// <summary>
        /// (待选人员的过滤)按用户级别，经办人等自定义过滤
        /// </summary>
        public OperatorFilter BeforeSelectFilter { get; set; }

        /// <summary>
        /// (待选人员的过滤)补充过滤，按用户职务
        /// </summary>
        [StringLength(WorkFlowNode.MaxFilterStrLength)]
        public string BeforeSelectMoreFilter { get; set; }

        /// <summary>
        ///  (自动匹配默认的选中人员)按用户级别，经办人等自定义过滤
        /// </summary>
        public OperatorFilter SelectedFilter { get; set; }

        /// <summary>
        ///   (自动匹配默认的选中人员)  补充过滤，按用户职务
        /// </summary>
        [StringLength(WorkFlowNode.MaxFilterStrLength)]
        public string SelectedMoreFilter { get; set; }

        /// <summary>
        /// 默认的时间期限（以天为单位吧）
        /// </summary>
        [StringLength(WorkFlowNode.MaxHandlingTimeLimitLength)]
        public string HandlingTimeLimit { get; set; }

        /// <summary>
        /// 在可确定下一步的节点和人员后，是否自动发送
        /// </summary>
        public bool IsAutoSendToNext { get; set; }

        [StringLength(WorkFlowNode.MaxOptionFunctionLength)]
        public string OptionFunction { get; set; }

        [IgnoreMap]
        public WorkflowNodeCustomData CustomData { get; set; }
    }
}
